@extends('plugin.layout.base')
@section('add_css')

@endsection
@section('content')

    <div class="layui-card">
        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                @if($navs)
                    @foreach($navs as $k=>$v)
                        <li class="{{ $v['id']==$on_id?'layui-this':'' }}">
                            <a href="{{ action($controller.'@index',['category_id'=>$v['id']]) }}">{{ $v['name'] }}</a>
                        </li>
                    @endforeach
                @endif

            </ul>
            <div class="layui-tab-content">

                <div class="layui-tab-item layui-show">
                    @include('plugin.'.$controller_base_lower.'.form')
                    @include('plugin.layout.table')
                </div>
            </div>
        </div>
    </div>
@endsection
@section('foot_js')
    @include('plugin.layout.ListConfig')
    <script>

        listConfig.index_url="{!!  plugin_url($controller_base,'getList',['category_id'=>$on_id])  !!}";
        listConfig.create_url='{!!  plugin_url($controller_base,'create',['category_id'=>$on_id]) !!}';
        layui.use(['index', 'listTable'], function () {
            var $ = layui.$
                , listTable = layui.listTable;

            cols = [[
                {type: 'checkbox'}
                , {field: 'id', width: 80, title: 'ID', sort: true}
                , {field: 'sort', width: 80, title: '排序',edit: 1}
                , {field: 'category_name', title: '分类', width: 120}
                , {field: 'level_name', title: '级别', width: 150}
                , {field: 'name', title: '名称'}
                , {field: 'memory', title: '内存',width:120}
                , {field: 'disk', title: '硬盘',width:120}
                , {field: 'area', title: '地区',width:120}
                , {
                    field: 'is_hot', width: 100, title: '热门', templet: function (d) {
                        return layui_switch('is_hot', d, '热门|默认')
                    }
                }
                , {
                    field: 'is_checked', width: 100, title: '状态', templet: function (d) {
                        return layui_switch('is_checked', d, '显示|隐藏')
                    }
                }
                , {field: 'created_at', title: '发布日期',width:180}

                , {title: '操作', minWidth: 180, align: 'center', toolbar: '#tpl-create-edit'}
            ]]
            //渲染
            listTable.render(listConfig.index_url, cols);
            //监听搜索
            listTable.search();


        });
    </script>
@endsection